<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%-- 引入页面头 --%>
<%@ include file="/pageHead.jsp"%>
<form name="form1" id="form1" action="<%-- ${systemctx}/sample/saveSample.web --%>" method="post">
	<div class="pageMain">
		<div class="pageTitle">
		<%=MessageResourcesUtils.getMessage(request, "systemmanage.bascmanagement.title") %>
		<span></span>
		<%=MessageResourcesUtils.getMessage(request, "systemmanage.province.provinceList.title") %>
		<span></span>
		<%=MessageResourcesUtils.getMessage(request, "systemmanage.province.province.title") %>
		</div>
		<div class="pageBody">
			<div class="form-group">
				<ul>
					<li>
						<i></i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.province.provinceList.openbankprovincecode") %></label>
						<span><input type="text" id="provincecode" name="provincecode" value="" /></span>
					</li>
					<li>
						<i></i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.province.provinceList.openbankprovincename") %></label>
						<span><input type="text" id="provincename" name="provincename" value="" /></span>
					</li>
				</ul>		
			</div>	
		</div>
		<div class="button-group">
			<input type="button" class="btn btn-default" id="butQuery" name="butQuery" value="<%=MessageResourcesUtils.getMessage(request, "common.button.query") %>" />
			<input type="button" class="btn btn-default" onclick="provinceAdd()" value="<%=MessageResourcesUtils.getMessage(request, "common.button.add") %>" />
		</div>
		<table width="100%">
			<tbody>
				<tr>
					<td>
						<table id="datagrid"></table>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</form>
<script type="text/javascript">
	$(document).ready(function() {
		//加载分页控件 datagrid
		$('#datagrid').issdatagrid({
			formid : 'form1',
			title : '<%=MessageResourcesUtils.getMessage(request, "systemmanage.province.provinceList.openbankprovincelist") %>',
			width : 'auto',
			nowrap : true,
			autoRowHeight : false,
			singleSelect : true,
			striped : true,
			//collapsible:true,
			url : '${systemctx}/systemmanage/province/queryProvinceListInfoDataGrid.json',
			sortName : 'modifytime',
			sortOrder : 'desc',
			remoteSort : true,
			idField : 'id',
			pagination : true,
			rownumbers : true,
			showFooter : true,
			queryParams:$('#form1').serializeObject(),
			columns : [ [{
				field : 'id',
				title : '<%=MessageResourcesUtils.getMessage(request, "common.button.operation") %>',
				width : 90,
				align : 'center',
				formatter : operate
			},{
				title : '<%=MessageResourcesUtils.getMessage(request, "systemmanage.province.provinceList.openbankprovincecode") %>',
				field : 'provincecode',
				width : 100,
				sortable : true,
				align : 'left'
			}, {
				title : '<%=MessageResourcesUtils.getMessage(request, "systemmanage.province.provinceList.openbankprovincename") %>',
				field : 'provincename',
				width : 160,
				sortable : true,
				align : 'left'
			}, {
				title : '<%=MessageResourcesUtils.getMessage(request, "systemmanage.province.provinceList.branchunitecode") %>',
				field : 'branchunitecode',
				width : 160,
				sortable : true,
				align : 'left'
			} ] ],
			onLoadSuccess : function(data) {

			}
		});

		$('#butQuery').click(function() {
			$('#datagrid').datagrid('load',$('#form1').serializeObject());
		});

		function operate(val, row) {
			return '<a href="javascript:void(0);" class="easyui-linkbutton" onclick="provinceUpdate('
					+ val + ')"><%=MessageResourcesUtils.getMessage(request, "common.button.update") %></a> <a href="javascript:void(0);" class="easyui-linkbutton" onclick="provinceDelete('
					+ val + ')"><%=MessageResourcesUtils.getMessage(request, "common.button.delete") %></a> ';
		}

	});
	function provinceAdd() {
		$(this).isswindow({
			title : '省信息-新增',
			noheader : true,
			url : '${systemctx}/systemmanage/province/toAddProvince.web'
		});
	}
	
	function provinceUpdate(val) {
		var id = val;
		$(this).isswindow({
			title : '省信息-修改',
			noheader : true,
			url : '${systemctx}/systemmanage/province/toUpdateProvince.web?id=' + id
		});
	}
	
	function provinceDelete(val) {
		var id = val;
		if (confirm("<%=MessageResourcesUtils.getMessage(request, "alertinfo.common.jsp.alert2") %>")) {
			//正在执行...
			showSending();
			$.ajax({
				type : 'GET',
				url : '${systemctx}/systemmanage/province/deleteProvince.json?id=' + id,
				dataType : 'json',
				success : function(data) {
					//关闭执行...
					closeSending();
					if(data.message == "<%=MessageResourcesUtils.getMessage(request, "alertinfo.common.java.alert3")%>"){
						//显示AJAX请求后的提示信息
						$.fn.ajaxmessage(data);
						$('#datagrid').datagrid('reload',
								$('#form1').serializeObject());
						$('#datagrid').datagrid('clearSelections');
					}else if(data.message == "<%=MessageResourcesUtils.getMessage(request, "systemmanage.province.provinceList.alert1")%>"){
						$.fn.ajaxmessage(data);
					}
				}
			});
		}
	}
</script>
<%-- 引入页面尾 --%>
<%@ include file="/pageFloor.jsp"%>